﻿using IBll;
using IDal;
using MD5Hash;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bll
{
    public class UserMagerBll : IUserMagerBll
    {
         public UserMagerBll(IStuDal<UserMager> stuDa)
        {
            StuDa = stuDa;
        }

        public IStuDal<UserMager> StuDa { get; }

        public UserMager Loing(string name, string pwd)
        {
            var lin = StuDa.GetValues().FirstOrDefault(x => x.UserMagerName == name);
            if (lin==null)
            {
                lin = new UserMager { UserMagerId = -1 };
            }
            else
            {
                if (lin.UserMagerPwd!=pwd)
                {
                    lin = new UserMager { UserMagerId = -2 };

                }
            }
             return lin;


        }
    }
}
